package se.nikmel.AnDisper.Display;

public class DisplaySetup {
	public enum E_CONFIGURATION {
		SINGLE, DUAL_HORIZONTAL, DUAL_VERTICAL
	};
	private E_CONFIGURATION m_eSetup;
	private DisperDisplay m_dspLeftOrTopScreen;
	private DisperDisplay m_dspRightOrBottomScreen;
	
	// Initiera en signle-screen
	public DisplaySetup(DisperDisplay p_dspDisplay){
		m_eSetup=E_CONFIGURATION.SINGLE;
		m_dspLeftOrTopScreen = p_dspDisplay;
	}
	public DisplaySetup(DisperDisplay p_dspLeftOrTopScreen, DisperDisplay p_dspRightOrBottomScreen){
		m_eSetup=E_CONFIGURATION.DUAL_HORIZONTAL;
		m_dspLeftOrTopScreen = p_dspLeftOrTopScreen;
		m_dspRightOrBottomScreen = p_dspRightOrBottomScreen;
	}
	
	public E_CONFIGURATION getConfiguration()
	{
		return m_eSetup;		
	}
	public DisperDisplay getLeftOrTopDisplay(){
		return m_dspLeftOrTopScreen;
	}
	public DisperDisplay getRightOrBottomDisplay(){
		return m_dspRightOrBottomScreen;
	}
	// Returns the coded message to return to server
	public String getProtocolCode(){
		if(m_eSetup==E_CONFIGURATION.SINGLE)
			return m_dspLeftOrTopScreen.getID();
		else
			return m_dspLeftOrTopScreen.getID() + "|" + m_dspRightOrBottomScreen.getID();
	}
// Returns friendly text
	public String toString(){
		if(m_eSetup==E_CONFIGURATION.SINGLE)
			return m_dspLeftOrTopScreen.getName();
		else
			return m_dspLeftOrTopScreen.getName() + " LeftOf " + m_dspRightOrBottomScreen.getName();
	}
}